import request from '@/utils/request';

const BASE_API = '/menu';

export default {
  // 获取树形菜单
  getMenuTree(params) {
    return request({
      url: `${BASE_API}/tree`,
      method: 'get',
      params,
    });
  },

  // 添加菜单
  updateMenu(data) {
    return request({
      url: `${BASE_API}/update`,
      method: 'post',
      data,
    });
  },

  // 根据菜单id删除菜单
  delById(menuId) {
    return request({
      url: `${BASE_API}/del/${menuId}`,
      method: 'delete',
    });
  },
  // 根据菜单id获取菜单数据
  getById(menuId){
    return request({
      url: `${BASE_API}/get/${menuId}`,
      method: 'get',
    });
  },

  // 获取路由
  getRouters(){
    return request({
      url: `${BASE_API}/get/routers`,
      method: 'get',
    });
  }
};
